<?php
# http://projects:8081/cdapp-2kt-api/api/contacts_initial_inport.php

include_once '_portal.php';

$json = json_parse(file_get_contents('./contacts_initial_data.json'));
$sql = "INSERT INTO `2kt_contacts`(`name`, `tags`, `phones`) VALUES ";
foreach ($json as $key => $value) {
  $tags = json_stringify($value['tags']);
  $phones = json_stringify($value['phones']);
  $sql .= "('{$value['name']}', '{$tags}', '{$phones}'),";
}
$sql = rtrim($sql, ',');
$result = exec_sql($sql);
output($result);